]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
network-agent: Focus the first reactive entry
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 14 Sep 2011 23:22:29 +0000 (01:22 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 19 Sep 2011 19:26:32 +0000 (21:26 +0200)
Currently network dialogs don't focus password entries, which means
that rather than entering their password directly, users first have
to click the entry (or tab around the dialog).
Instead, put keyboard focus on the first entry that requires user
input.

https://bugzilla.gnome.org/show_bug.cgi?id=659133

js/ui/networkAgent.js

index 90480e7c2f33544df996feeb5d843bc3d00ea36e..43fd9a14e3d2336ce1531c33d614132aa7f81e9a 100644 (file)
@@ -91,6 +91,7 @@ NetworkSecretDialog.prototype = {
         }
 
         let secretTable = new St.Table({ style_class: 'network-dialog-secret-table' });
+        let initialFocusSet = false;
         let pos = 0;
         for (let i = 0; i < this._content.secrets.length; i++) {
             let secret = this._content.secrets[i];
@@ -109,6 +110,11 @@ NetworkSecretDialog.prototype = {
                 secret.valid = secret.value.length > 0;
 
             if (reactive) {
+                if (!initialFocusSet) {
+                    this.setInitialKeyFocus(secret.entry);
+                    initialFocusSet = true;
+                }
+
                 secret.entry.clutter_text.connect('text-changed', Lang.bind(this, function() {
                     secret.value = secret.entry.get_text();
                     if (secret.validate)